package com.mentaleye.dal.dao.mybatis;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.mentaleye.dal.dao.StudentDisciplineDao;
import com.mentaleye.dal.model.StudentDiscipline;
import com.mentaleye.dal.model.StudentDisciplineExample;
import com.mentaleye.dal.service.StudentDisciplineMapper;

@Repository
public class StudentDisciplineDaoImpl implements StudentDisciplineDao {

	@Autowired
	private StudentDisciplineMapper dataMapper;

	@Override
	public boolean insertRecord(StudentDiscipline data) {
		boolean isSuccess = false;
		int result = this.dataMapper.insert(data);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public boolean updateRecord(StudentDiscipline data) {
		boolean isSuccess = false;
		int result = this.dataMapper.updateByPrimaryKey(data);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}

	@Override
	public List<StudentDiscipline> getListByExample(StudentDisciplineExample example) {
		return this.dataMapper.selectByExample(example);
	}

	@Override
	public List<Map<String,Object>> getListByMap(Map<String, Object> map) {
		return this.dataMapper.getListByMap(map);
	}

	@Override
	public boolean deleteByExample(StudentDisciplineExample example) {
		boolean isSuccess = false;
		int result = this.dataMapper.deleteByExample(example);
		if (result > 0) {
			isSuccess = true;
		}
		return isSuccess;
	}
}
